<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib prefix="s" uri="http://shiro.apache.org/tags" %>

<div class="page-sidebar-wrapper">
	<div class="page-sidebar navbar-collapse collapse">
		<!-- BEGIN SIDEBAR MENU -->
		<ul class="page-sidebar-menu " data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200">
			<!-- DOC: To remove the sidebar toggler from the sidebar you just need to completely remove the below "sidebar-toggler-wrapper" LI element -->
			<li class="sidebar-toggler-wrapper">
				<!-- BEGIN SIDEBAR TOGGLER BUTTON -->
				<div class="sidebar-toggler">
				</div>
				<!-- END SIDEBAR TOGGLER BUTTON -->
			</li>
			<!-- DOC: To remove the search box from the sidebar you just need to completely remove the below "sidebar-search-wrapper" LI element -->
			<li class="sidebar-search-wrapper">
				<!-- BEGIN RESPONSIVE QUICK SEARCH FORM -->
				<form class="sidebar-search " action="extra_search.html" method="POST">
					<a href="javascript:;" class="remove">
						<i class="icon-close"></i>
					</a>
					<div class="input-group">
						<input type="text" class="form-control" placeholder="Search...">
						<span class="input-group-btn">
						<a href="javascript:;" class="btn submit"><i class="icon-magnifier"></i></a>
						</span>
					</div>
				</form>
				<!-- END RESPONSIVE QUICK SEARCH FORM -->
			</li>
			<s:hasRole name="superAdmin">
				<c:forEach items="${allMenu}" var="m">
					<li>
						<a href="javascript:;">
							<i class="fa ${m.menuIcon }"></i>
							<span class="title">${m.permissionName }</span>
							<span class="arrow "></span>
						</a>
						<c:if test="${fn:length(m.children)>0 }">
							<ul class="sub-menu">
								<c:forEach items="${m.children }" var="subMenu">
									<li>
										<a href="${subMenu.menuUrl }" class="ajaxify">
										<i class="fa ${subMenu.menuIcon }"></i>
										${subMenu.permissionName}</a>
									</li>
								</c:forEach>
							</ul>
						</c:if>
					</li>
				</c:forEach>
			</s:hasRole>
			
			<s:lacksRole name="superAdmin">
				<c:forEach items="${allMenu}" var="m">
				<s:hasPermission name="${m.permissionSign }">
					<li>
						<a href="javascript:;">
							<i class="fa ${m.menuIcon }"></i>
							<span class="title">${m.permissionName }</span>
							<span class="arrow "></span>
						</a>
						<c:if test="${fn:length(m.children)>0 }">
							<ul class="sub-menu">
								<c:forEach items="${m.children }" var="subMenu">
								    <s:hasPermission name="${subMenu.permissionSign }">
									<li>
										<a href="${subMenu.menuUrl }" class="ajaxify">
										<i class="fa ${subMenu.menuIcon }"></i>
										${subMenu.permissionName}</a>
									</li>
									</s:hasPermission>
								</c:forEach>
							</ul>
						</c:if>
					</li>
				</s:hasPermission>
				</c:forEach>
			</s:lacksRole>
		</ul>
		<!-- END SIDEBAR MENU -->
	</div>
</div>